package gui;

import javax.swing.Action;
import javax.swing.JButton;

import java.awt.BorderLayout;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.beans.PropertyChangeListener;

import fiziksobject.*;
import physics.*;

public class GravityEditor extends ForcerEditor<Gravity> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private GravityEditor thiz = this;
	public GravityEditor(final Gravity g) {
		super(g);
		final VectorModifier vm = new VectorModifier(g.getStrength());
		add(vm);
		JButton ok = new JButton("Ok");
		add(ok,BorderLayout.SOUTH);
		ok.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				g.setStrength(vm.getVector());
				WindowEvent wev = new WindowEvent(thiz, WindowEvent.WINDOW_CLOSING);
                Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(wev);
			}
		});
	}
}
